package com.kuang.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public class ModelTest1 {
    /*@RequestMapping("/m1/t1")
    public String test(HttpServletRequest req, HttpServletResponse res) {
        HttpSession session = req.getSession();
        System.out.println(session.getId());

        return "test";
    }*/

    @RequestMapping("/m1/t1")
    public String test(Model model) {
        model.addAttribute("msg", "m1t1model");

        // return "/WEB-INF/jsp/test.jsp";  // 转发（无视图解析器）
        // return "forward:/WEB-INF/jsp/test.jsp";  // 转发（无视图解析器）
        return "redirect:/index.jsp";  // 重定向

    }

}
